package com.sg.dto.biz.app.common;

import com.sg.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

/**
 * @desc EntityIdDto
 * @使用场景
 */
@Data
public class EntityIdDto extends BaseDto implements Serializable {

    /**
     * 内容表主键ID
     */
    @NotNull(message = "内容表主键ID不能为空")
    @ApiModelProperty("内容表主键ID")
    private String entityId;

    /**
     * 排序
     */
    @NotNull(message = "排序不能为空")
    @ApiModelProperty("排序")
    private Long orderNumber;
    /**
     * 归属内容表主键ID
     */
    @ApiModelProperty("归属内容表主键ID")
    private String ownEntityId;

    /**
     * 自定义字段
     */
    @ApiModelProperty("自定义字段")
    private String customField;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        EntityIdDto that = (EntityIdDto) o;
        return entityId == that.entityId && orderNumber == that.orderNumber && ownEntityId == that.ownEntityId && customField == that.customField;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), entityId, orderNumber, ownEntityId, customField);
    }

}
